package com.hedl.studyandjava8.test.practice;

/**
 * @author Big Watermelon
 * @description Varargs 可变参数使用
 * @date 2024/02/18/12:52
 */
public class StudyVarargs {
    static Integer sumVarargs(Integer ... arr){
        Integer sum , i;
        sum = 0;
        for (i = 0; i < arr.length; i++){
            sum += arr[i];
        }
        return sum;
    }

    public static void main(String[] args) {
        Integer sum = 0;
        sum = sumVarargs(new Integer[]{10,12,30});
        System.out.println("数字相加之和为： "+sum);
    }
}
